<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="box">hello</div>
    <ul>
      <li>1</li>
      <li id="li2">2</li>
      <li>3</li>
    </ul>
    <script>
      // 同过ID获取标签对象
      console.log(document.getElementById("box"));
      console.log(document.getElementById("li2"));
      // id属性值可以作为JS的全局变量，指向当前标签对象
      const li2 = document.getElementById("li2");
      // li2 = null;
      console.log(li2);
    </script>
  </body>
</html>
